Lag label#228
Open
danshapero wants to merge 15 commits into
Open
Conversation
danshapero
commented
May 15, 2026
pbrubeck
requested changes
May 15, 2026
Collaborator
|
I just noticed that #227 might potentially be useful for similar purposes.
I think it's fine to support both modes. |
pbrubeck
reviewed
May 17, 2026
| final_time = 10.0 | ||
| num_steps = int(final_time / float(dt)) | ||
| for step in range(num_steps): | ||
| stepper.advance() |
Collaborator
There was a problem hiding this comment.
Can we add an assertion here?
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
pbrubeck
reviewed
May 18, 2026
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
pbrubeck
reviewed
May 18, 2026
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
pbrubeck
reviewed
May 18, 2026
Comment on lines
+88
to
+98
| # A :class:`ufl.Label` to mark nodes that are only evaluated at the start of | ||
| # the timestep. | ||
| lag_label = Label() | ||
|
|
||
|
|
||
| def lag(expr): | ||
| """Mark a sub-expression to be evaluated only at the start of the | ||
| timestep during the implicit solve.""" | ||
| return Variable(expr, lag_label) | ||
|
|
||
|
|
Collaborator
There was a problem hiding this comment.
This file does not seem the right place to define this. I think we should be creating a new file.
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
Co-authored-by: Pablo Brubeck <brubeck@protonmail.com>
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
pbrubeck
reviewed
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #221. This PR adds a function
lagwhich labels a single expression in a form for holding back to the start of a timestep. As @pbrubeck thought, implementing it amounted to modifyingirksome.tools.replace. I added a test based on lagging the conductivity in the Stefan problem. Without lagging, that fails because of the conditional.In addition to giving you an escape hatch, you can use lagging to define nonlinear preconditioners. I have a demo of this for the Allen-Cahn equation coded up just using petsc4py which I think is pretty compelling. @JHopeCollins and I are working on getting AuxiliaryOperatorSNES merged into Firedrake: firedrakeproject/firedrake#5119. Once that's merged I can write an Irksome demo showing that off, either in this PR or a separate one.